# Maintainer: David Runge <dvzrv@archlinux.org>

_name=configclass
pkgname=python-configclass
pkgver=0.2.0
pkgrel=5
pkgdesc="A Python class to hold configuration values"
arch=('any')
url="https://github.com/schettino72/configclass/"
license=('MIT')
depends=('python-mergedict')
makedepends=('python-setuptools')
checkdepends=('python-pytest')
source=("https://files.pythonhosted.org/packages/source/${_name::1}/${_name}/${_name}-${pkgver}.tar.gz")
sha512sums=('60a5ec9e77b7f01139a44d17a2d4bc2136f36ab367a283205192804ec8f60e1d78ec2df237ffe8f33c00d4e05bc047f71dd9da840f701436e5014c4cf499c4cc')
b2sums=('150c97c918e0d43f8d8c9810b527b64dd2b216b98d89272102b050a49aa6c49a009a4d29a530331a086eb31fc8474f27b5227c2b2db47f2ef046e30abc4cdcd9')

prepare() {
  mv -v "$_name-$pkgver" "$pkgname-$pkgver"
}

build() {
  cd "$pkgname-$pkgver"
  python setup.py build
}

check() {
  cd "$pkgname-$pkgver"
  export PYTHONPATH="build:${PYTHONPATH}"
  pytest -v
}

package() {
  cd "$pkgname-$pkgver"
  python setup.py install --skip-build \
                          --optimize=1 \
                          --root="${pkgdir}"
  install -vDm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
  install -vDm 644 {CHANGES,README.rst} -t "${pkgdir}/usr/share/doc/${pkgname}"
}
